home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / -archivi / -recent1 / nsm_tnw041b.lha / tracknameswindow / annomanno.a next >
Text File  |  1999-01-09  |  4KB  |  275 lines

  1.  
  2.  
  3. ;Various assembler-functions needed for programs
  4. ;that wants to communicate with the tracknameswindow-program.
  5. ;
  6. ;Many of these functions could have been included in
  7. ;the nsm-package, but I have chosen not to because there
  8. ;aren't any arexx-functions for those, and then it may be
  9. ;impossible to update NSM for future versions of octamed.
  10. ;
  11. ;Made by Kjetil S. Matheussen 1998-1999.
  12.  
  13.  
  14.  
  15.     xdef    _getcurrinstrumentinfostring
  16.     xdef    _getcurrinstrumentstring
  17.     xdef    _geteditorwindowtopleft
  18.     xdef    _geteditorwindowwidth
  19.     xdef    _getnumvisibletracks
  20.     xdef    _getscreenfontsize
  21.     xdef    _geteditorTextAttrstruct
  22.     xdef    _getleftmostvisibletrack
  23.     xdef    _gettracknamedata
  24.     xdef    _settracknamedata
  25.     xdef    _gettracknamedata2
  26.     xdef    _settracknamedata2
  27.     xdef    _settrackname
  28.     xdef    _gettrackname
  29.     xdef    _updatetrackwindow
  30.  
  31.     section    text,code
  32.  
  33. ;d0=octabase
  34. _getcurrinstrumentstring:
  35.     add.l        #$53e,d0
  36.     rts
  37.  
  38. ;d0=octabase
  39. _getcurrinstrumentinfostring:
  40.     add.l        #$541,d0
  41.     rts
  42.  
  43. ;a0=octabase
  44. _geteditorwindowtopleft:
  45.     move.w    $142(a0),d0
  46.     rts
  47.  
  48. ;a0=octabase
  49. _getnumvisibletracks:
  50.     moveq        #0,d0
  51.     move.b    $515(a0),d0
  52.     rts
  53.  
  54. ;a0=octabase
  55. _geteditorwindowwidth:
  56.     move.w    $78(a0),d0
  57.     rts
  58.  
  59.  
  60. ;a0=octabase
  61. _getscreenfontsize:
  62.     move.w    $410(a0),d0
  63.     rts
  64.  
  65. ;a0=octabase
  66. _geteditorTextAttrstruct:
  67.     add.l        #$41c,a0
  68.     cmp.l        #0,(a0)
  69.     beq.s        standardfont
  70.     move.l    a0,d0
  71.     rts
  72. standardfont:
  73.     moveq        #0,d0
  74.     rts
  75.  
  76. ;a0=octabase
  77. _getleftmostvisibletrack:
  78.     moveq        #0,d0
  79.     move.b    $75(a0),d0
  80.     rts
  81.  
  82. ;a0=octabase
  83. _gettracknamedata:
  84.     moveq        #-1,d1
  85.     moveq        #0,d2
  86.     bsr.s        _gettrackname
  87.     tst.l        d0
  88.     beq.s        finished
  89.  
  90.     moveq        #0,d0
  91.     move.b    (a0),d0
  92.     rts
  93.  
  94. ;a0=octabase,d6=newdata
  95. _settracknamedata:
  96.     moveq        #-1,d1
  97.     moveq        #0,d2
  98.     bsr.s        _gettrackname
  99.     tst.l        d0
  100.     beq.s        finished
  101.  
  102.     move.b    d6,(a0)
  103.     rts
  104.  
  105. ;a0=octabase
  106. _gettracknamedata2:
  107.     moveq        #-1,d1
  108.     moveq        #0,d2
  109.     bsr.s        _gettrackname
  110.     tst.l        d0
  111.     beq.s        finished
  112.  
  113.     moveq        #0,d0
  114.     move.b    1(a0),d0
  115.     rts
  116.  
  117. ;a0=octabase,d6=newdata
  118. _settracknamedata2:
  119.     moveq        #-1,d1
  120.     moveq        #0,d2
  121.     bsr.s        _gettrackname
  122.     tst.l        d0
  123.     beq.s        finished
  124.  
  125.     move.b    d6,1(a0)
  126.     rts
  127.  
  128.  
  129. ;a0=octabase,a1=new string;d1=track,d2=placement,d3=block
  130. _settrackname:
  131.     exg        d3,d2
  132.     bsr.s        _gettrackname        ;the result is allso loaded into a0
  133.     tst.l        d0
  134.     beq.s        finished                ;Failed
  135.     exg        d2,d3
  136.     add.l        d2,a0
  137.     moveq        #8,d0
  138.     sub.l        d2,d0
  139.  
  140. loop:
  141.     cmp.b        #0,(a1)
  142.     bne.s        next
  143.     bra.s        setspace
  144. next:
  145.     move.b    (a1)+,(a0)+
  146. next2:
  147.     dbra        d0,loop
  148.  
  149. finished:
  150.     rts                                ;Finished!
  151.  
  152. setspace:
  153.     move.b    #$20,(a0)+            ;This is very probably unnecesarry...
  154.     bra.s        next2
  155.  
  156.  
  157.  
  158. ;a0=octabase,d1=track,d2=block
  159. _gettrackname:
  160.     move.l    d2,-(sp)
  161.  
  162.     andi.l    #$0000ffff,d1
  163.     andi.l    #$0000ffff,d2
  164.     lsl.l        #6,d2
  165.     add.l        d2,d1
  166.     addq.l    #2,d1
  167.  
  168.     add.l        #$168a,a0            ;all those constants....
  169.  
  170. nextname:
  171.     move.l    (a0),a0
  172.     cmp.l        #0,(a0)
  173.     beq.s        gettrackname_failed
  174.     dbra        d1,nextname
  175.  
  176.     add.l        #14,a0
  177.     move.l    a0,d0
  178.  
  179.     move.l    (sp)+,d2
  180.     rts
  181.  
  182. gettrackname_failed:
  183.     move.l    (sp)+,d2
  184.     moveq        #0,d0
  185.     rts
  186.  
  187.  
  188. _updatetrackwindow:
  189.  
  190. ;    Used registers in getoctabase:
  191. ;    A6 - exec.library
  192. ;    A5 - My message-port
  193. ;    A3 - Message
  194. ;    A1 - TNM-port
  195.  
  196.     movem.l        a3/a5-a6,-(sp)
  197.  
  198.     move.l        4.w,a6
  199.  
  200.     jsr            -$29a(a6)                            ;Creates a message-port
  201.     tst.l            d0
  202.     beq.s            exit
  203.     move.l        d0,a5
  204.  
  205.     lea            clearend(pc),a3
  206.  
  207.     moveq            #3,d0                                ;Reset the Message to nulls. Don't know if this is necesarry, but...
  208. loop2:
  209.     clr.l            -(a3)                                    ;A3 will eventullly be 'Message'
  210.     dbra            d0,loop2
  211.  
  212.  
  213.     move.l        a5,14(a3)                            ;Set the replyport for the message
  214.  
  215.     jsr            -120(a6)                                ;Disable interrupts
  216.  
  217.  
  218.     lea            tnmportname(pc),a1                ;Finds the NSM-port
  219.     jsr            -390(a6)
  220.     tst            d0
  221.     beq.s            could_not_find_port
  222.  
  223.  
  224.     move.l        d0,a0                                    ;Sends the message
  225.     move.l        a3,a1
  226.     jsr            -366(a6)
  227.  
  228.  
  229.     jsr            -126(a6)                                ;Enable interrupts
  230.  
  231.  
  232.     move.l        a5,a0                                    ;Waits for reply
  233.     jsr            -$180(a6)
  234.  
  235.  
  236. close_port:
  237.     move.l        a5,a0
  238.     jsr            -$2a0(a6)
  239.  
  240.  
  241. exit:
  242.     movem.l        (sp)+,a3/a5-a6
  243.     rts                                                    ;Finished!
  244.  
  245. could_not_find_port:
  246.     jsr            -126(a6)                                ;Enable interrupts
  247.     bra.s            close_port
  248.  
  249.  
  250.  
  251. tnmportname:
  252.     dc.b            "tracknamesport",0
  253.  
  254.  
  255.     dc.b            0                                        ;even
  256.  
  257.  
  258. Message:                                                    ;A Message-structure.
  259.     ;Structure message
  260.      ;Structure Node
  261.       dc.l          0            ;struct node *ln_succ
  262.       dc.l          0            ;struct node *ln_pred
  263.       dc.b          5            ;UBYTE ln_type=NT_MESSAGE
  264.       dc.b          0            ;UBYTE priority
  265.       dc.l          0            ;char *ln_Name
  266.      dc.l             0            ;struct MsgPort *mn_replyport
  267. clearend:
  268.      dc.w            20            ;UWORD mn_Length
  269.  
  270. ;End of Message structure. Length: 24 bytes
  271.  
  272.  
  273.     END
  274.  
  275.